import {Request, Response} from 'express';

class UploadController {
    async upload(req: Request, res: Response) {
        const files = req.files as Express.Multer.File[];
        const urls = files.map(file => ({
            filename: file.filename,
            url: `${req.protocol}://${req.get('host')}/static/${file.filename}`
        }));
        res.json({list: urls});
    }
}

export const uploadController = new UploadController();
